import arcpy
import os
from arcpy import env
import sys
reload(sys)
sys.setdefaultencoding('utf8')

try:
    arcpy.AddMessage('-----------start-----------')
    shp=arcpy.GetParameterAsText(0)#"F:/数据/云南县级行政区划/滇中kars1940.shp" #要处理的shp文件路径
    out_path=arcpy.GetParameterAsText(1)#"F:/数据/云南县级行政区划/滇中县级行政区"#输出文件夹的路径
    arcpy.AddMessage(shp)
    arcpy.AddMessage(out_path)
    with arcpy.da.SearchCursor(shp, ["SHAPE@",'NAME']) as cursor:
        for row in cursor:
            out_name=str(row[1])+'.shp'
            arcpy.AddMessage(out_name)
            arcpy.FeatureClassToFeatureClass_conversion (row[0],out_path,out_name)
    arcpy.AddMessage('-----------end-----------')
except arcpy.ExecuteError:
    print arcpy.GetMessages()
    